package cn.lut.service;

import cn.lut.service.handler.MyInvocationHandler;
import cn.lut.service.impl.SomeServiceImpl;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

/**
 * @user:dell
 * @date:2020年10月29 15:29
 */
public class MyApp {
    public static void main(String[] args) {
        SomeService someService=new SomeServiceImpl();
       InvocationHandler handler = new MyInvocationHandler(someService);
      SomeService proxy= (SomeService) Proxy.newProxyInstance(someService.getClass().getClassLoader(),someService.getClass().getInterfaces(),handler);
            proxy.doSome();
            System.out.println("================================================================");
            proxy.doOther();
    }
}
